local skel = fk.CreateSkill {
  name = "emo__zengli",
}

Fk:loadTranslationTable{
  ["emo__zengli"] = "赠礼",
  [":emo__zengli"] = "出牌阶段限一次，你可以弃置一张非基本牌并选择一名角色：若你有“硬币”，其使用的下一张伤害牌的伤害基数+1；若没有，其摸两张非伤害牌。",

  ["@emo__zengli"] = "赠礼:加伤",
  ["#emo__zengli-prompt1"] = "弃置1张非基本牌，令一名角色使用的下个伤害牌的伤害+1",
  ["#emo__zengli-prompt0"] = "弃置1张非基本牌，令一名角色摸2张非伤害牌",

  ["$emo__zengli1"] = "根本不够刺激",
  ["$emo__zengli2"] = "比想象中的有趣",
}

skel:addEffect("active", {
  anim_type = "support",
  card_num = 1,
  target_num = 1,
  prompt = function (self, player, selected_cards, selected_targets)
    return "#emo__zengli-prompt".. player:getMark("@@emo__coin")
  end,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).type ~= Card.TypeBasic
    and not player:prohibitDiscard(Fk:getCardById(to_select))
  end,
  target_filter = function (self, player, to_select, selected, selected_cards)
    return #selected == 0
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    room:throwCard(effect.cards, skel.name, player, player)
    local to = effect.tos[1]
    if to.dead then return end
    if player:getMark("@@emo__coin") > 0 then
      room:addPlayerMark(to, "@emo__zengli")
    else
      local cards = table.filter(room.draw_pile, function (id)
        return not Fk:getCardById(id).is_damage_card
      end)
      if #cards > 0 then
        room:obtainCard(to, table.random(cards, 2), false, fk.ReasonPrey, player, skel.name)
      end
    end
  end,
})

skel:addEffect(fk.CardUsing, {
  mute = true,
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@emo__zengli") > 0 and data.card.is_damage_card
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    data.additionalDamage = (data.additionalDamage or 0) + player:getMark("@emo__zengli")
    player.room:setPlayerMark(player, "@emo__zengli", 0)
  end,
})

return skel
